package com.itheima.project.feign;

import com.itheima.project.basic.ResponseWrap;
import com.itheima.project.hystrix.CustomerAdapterHystrix;
import com.itheima.project.vo.security.CustomerVo;
import com.itheima.project.vo.security.ResourceVo;
import com.itheima.project.vo.security.RoleVo;
import com.itheima.project.vo.security.UserVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Description：客户权限适配服务接口定义
 */
@FeignClient(value = "module-security-web",fallback = CustomerAdapterHystrix.class)
public interface CustomerAdapterFeign {

    /**
     * @Description 按客户名查找客户
     * @param username 登录名
     * @return
     */
    @GetMapping("customer-adapter/find-customer-username-enterprise/{username}/{enterpriseId}")
    ResponseWrap<UserVo> findCustomerByUsernameAndEnterpriseId(@PathVariable("username") String username,
                                                               @PathVariable("enterpriseId") Long enterpriseId);


    /**
     * @Description 按客户手机查找客户
     * @param mobile 登录名
     * @return
     */
    @GetMapping("customer-adapter/find-customer-mobile-enterprise/{mobile}/{enterpriseId}")
    ResponseWrap<UserVo> findCustomerByMobileAndEnterpriseId(@PathVariable("mobile")String mobile,
                                               @PathVariable("enterpriseId")Long enterpriseId);
    /**
     * @Description 按微信openId查找客户
     * @param openId 登录名
     * @return
     */
    @GetMapping("customer-adapter/find-customer-openid-enterprise/{openId}/{enterpriseId}")
    ResponseWrap<UserVo> findCustomerByOpenIdAndEnterpriseId(@PathVariable("openId")String openId,
                                                             @PathVariable("enterpriseId")Long enterpriseId);
    /**
     * @Description 查找客户所有角色
     * @param customerId 客户Id
     * @return
     */
    @GetMapping("customer-adapter/find-role-customer/{customerId}")
    ResponseWrap<List<RoleVo>> findRoleByCustomerId(@PathVariable("customerId")Long customerId);

    /**
     * @Description 查询客户有资源
     * @param customerId 客户Id
     * @return
     */
    @GetMapping("customer-adapter/find-resoure-customer/{customerId}")
    ResponseWrap<List<ResourceVo>> findResourceByCustomerId(@PathVariable("customerId")Long customerId);

    /***
     * @description 查询当前客户
     * @param customerId
     * @return
     */
    @GetMapping("customer-adapter/find-cuttent-customer/{customerId}")
    ResponseWrap<UserVo> findCurrentCustomer(@PathVariable("customerId")Long customerId);

    /**
     * @Description 注册客户
     * @param customerVo 对象信息
     * @return
     */
    @PostMapping("customer")
    ResponseWrap<CustomerVo> registerUser(@RequestBody CustomerVo customerVo);
}
